/*
 * Zooom.java
 *
 * Created on 23 janvier 2008, 17:00
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package images;

public class Zooom {
    
    
    int[] lesZooms = {7, 15, 20, 30, 50, 70, 100, 150, 200, 300, 500, 700, 1000, 2000, 3000, 5000};
    
    /** Creates a new instance of Zooom */
    public Zooom() {
        
    }
    
    
    public int getZoomPlus(int currentZoom, int zoomTout){
        int nouveauZoom=7;
        
        int i=0;
        while ((currentZoom>=nouveauZoom) && (i<lesZooms.length)){
            nouveauZoom = lesZooms[i++];
        }
        
        
        
        if((currentZoom<zoomTout) && (zoomTout<nouveauZoom)){
            nouveauZoom = zoomTout;
        }
        
        
        return nouveauZoom;
    }
    
    
    
    public int getZoomMoins(int currentZoom, int zoomTout){
        int nouveauZoom=5000;
        
        int i=lesZooms.length-1;
        while ((currentZoom<=nouveauZoom) && (i>=0)){
            nouveauZoom = lesZooms[i--];
        }
        
        if((nouveauZoom<zoomTout) && (zoomTout<currentZoom)){
            nouveauZoom = zoomTout;
        }
        
        return nouveauZoom;
    }
    
}